package com.sneakxy.cloudbase.platform.service;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.sneakxy.cloudbase.platform.bean.dto.RoleDTO;
import com.sneakxy.cloudbase.platform.bean.dto.RoleTreeDTO;
import com.sneakxy.cloudbase.platform.utils.web.DataGrid;
import com.sneakxy.cloudbase.platform.utils.web.PageSearch;
import com.sneakxy.cloudbase.platform.utils.web.Response;

@FeignClient(name="security-producer", path = "/security/api/role")
public interface RoleClient {

	@PostMapping("one")
	public Response<RoleDTO> one(
			@RequestParam(name="id", required = true)
			String id);
	
	@PostMapping("datagrid")
	public Response<DataGrid<RoleDTO>> datagrid(@SpringQueryMap PageSearch<String> search);
	
	@PostMapping("add")
	public Response<RoleDTO> add(@SpringQueryMap RoleDTO role);
	
	@PostMapping("validate")
	public Response<Boolean> validate(@RequestParam(name="id") String id);
	
	@PostMapping("edit")
	public Response<RoleDTO> edit(@SpringQueryMap RoleDTO role);
	
	@PostMapping("remove")
	public Response<String> remove(@RequestParam(name="ids") String[] ids);
	
	@PostMapping("tree")
	public Response<RoleTreeDTO> tree(@RequestParam(name="id") String id);
	
	@PostMapping("perm")
	public Response<String> perm(
			@RequestParam(name="id")
			String id, 
			@RequestParam(name="permIds")
			String[] permIds);
	
	@PostMapping("roles")
	public Response<List<String>> roles(
			@RequestParam(name="accountId")
			String accountId);
	
}
